﻿using System;

namespace SPSDeploy
{
    /// <summary>
    /// Utility methods
    /// </summary>
    internal static class Tools
    {

        /// <summary>
        /// Display new line
        /// </summary>
        internal static void DisplayInformation()
        {
            Console.WriteLine();
        }

        /// <summary>
        /// Display information message
        /// </summary>
        /// <param name="value"></param>
        internal static void DisplayInformation(string value)
        {
            Console.WriteLine(value);
        }

        /// <summary>
        /// Display information message
        /// </summary>
        /// <param name="format"></param>
        public static void DisplayInformation(string format, params object[] args)
        {
            Console.WriteLine(format, args);
        }

        /// <summary>
        /// Display warning message
        /// </summary>
        /// <param name="value"></param>
        internal static void DisplayWarning(string value)
        {
            ConsoleColor color = Console.ForegroundColor;
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("WARNING: {0}", value);
            Console.ForegroundColor = color;
        }

        /// <summary>
        /// Display error message
        /// </summary>
        /// <param name="exception"></param>
        internal static void DisplayError(Exception exception)
        {
            ConsoleColor color = Console.ForegroundColor;
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("ERROR: {0}\r\n\r\nStack Trace: {1}", exception.Message, exception.StackTrace);
            Console.ForegroundColor = color;
        }

    }
}